package embuzzled.g5;

import java.awt.Color;
import java.util.ArrayList;

public class PuzzleSet {

	private ArrayList<Puzzle> puzzles;
	
	public PuzzleSet() {

		puzzles = new ArrayList<Puzzle>();
	}
	
	/**
	 *  Adds a puzzle to this puzzle set.
	 * @param p
	 */
	public void add(Puzzle p) {
		puzzles.add(p);
	}
	
	/**
	 *  Assigns colors to all puzzles without fixed color schemes.
	 * @param possibleColors A list of the colors a puzzle may use.
	 */
	public void assignColors(Color[] possibleColors) {
		
		//TODO - less hardcoded algorithm
		//       Takes in Color[] possibleColors
		//       And assigns colors to each puzzle in the set
		//       Perhaps puzzles can have a coloring strategy
		//       identified with the constants in Constant class.
		
		//Color colors[] = {Color.BLUE, Color.GREEN, Color.RED, Color.ORANGE};
		
		for (int i = 0; i < puzzles.size(); i++) {
			puzzles.get(i).setColor(possibleColors);
		}
		
	}
	
	/**
	 *  Returns the number of discrete puzzles within this set.
	 * @return
	 */
	public int getSize() {
		return puzzles.size();
	}
	
	/**
	 *  Returns the puzzle at index idx.
	 * @param idx Index.
	 * @return The puzzle at index idx.
	 */
	public Puzzle get(int idx) {
		return puzzles.get(idx);
	}
}
